/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.login.plugin.login.view;

import android.text.Layout;
import android.text.Selection;
import android.text.Spannable;
import android.text.method.LinkMovementMethod;
import android.view.MotionEvent;
import android.widget.TextView;

public class c extends LinkMovementMethod {
    private static c a;

    public static c a() {
        if (null == a)
            a = new c();
        return a;
    }

    public boolean onTouchEvent(TextView paramTextView, Spannable paramSpannable, MotionEvent paramMotionEvent) {
        int i = paramMotionEvent.getAction();
        if ((i == 1) || (i == 0)) {
            int j = (int) paramMotionEvent.getX();
            int k = (int) paramMotionEvent.getY();
            j -= paramTextView.getTotalPaddingLeft();
            k -= paramTextView.getTotalPaddingTop();
            j += paramTextView.getScrollX();
            k += paramTextView.getScrollY();
            Layout localLayout = paramTextView.getLayout();
            int l = localLayout.getLineForVertical(k);
            int i1 = localLayout.getOffsetForHorizontal(l, j);
            a[] arrayOfa = (a[]) paramSpannable.getSpans(i1, i1, a.class);
            if (arrayOfa.length != 0) {
                if (i == 1) {
                    arrayOfa[0].onClick(paramTextView);
                }
                else if (i == 0) {
                    int i2 = arrayOfa[0].a();
                    int i3 = arrayOfa[0].b();
                    Selection.setSelection(paramSpannable, paramSpannable.getSpanStart(arrayOfa[0]) + i2,
                            paramSpannable.getSpanEnd(arrayOfa[0]) + i3);
                }
                return true;
            }
            Selection.removeSelection(paramSpannable);
        }
        return false;
    }
}